﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using db = DataContext;

namespace LogicLibrary
{
	public class Account
	{
		public static bool Login(string name, string pass, out db.Account account)
		{
			using (db.DbDataContext context = new db.DbDataContext())
			{
				if (context.Account.Count(x => x.AccountName.Equals(name) && x.Passport.Equals(pass)) == 1)
				{
					account = context.Account.Single(x => x.AccountName.Equals(name) && x.Passport.Equals(pass));
					return true;
				}
			}
			account = null;
			return false;
		}
	}
}
